import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// 新增：引入 Pinia
import { createPinia } from 'pinia'

// 导入API服务
import api from './services/api'

// 导入Element Plus图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

const app = createApp(App)

// 新增：创建 Pinia 实例并挂载
const pinia = createPinia()
app.use(pinia)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.config.globalProperties.$api = api

app
    .use(router)
    .use(ElementPlus)
    .mount('#app')